package io.kiki.sba.registry.store.api.repository;

import io.kiki.sba.registry.common.model.store.AppRevision;
import io.kiki.sba.registry.store.api.multi.MultiDataCenterListener;

import java.util.*;


public interface AppRevisionRepository extends MultiDataCenterListener {


    void register(AppRevision appRevision) throws Exception;

    /**
     * check if revisionId exist
     */
    boolean exist(String revisionId);

    /**
     * get AppRevision
     */
    AppRevision queryRevision(String revision);

    boolean heartbeat(String revision);

    boolean heartbeatDB(String revision);

    Collection<String> availableRevisions();

    List<AppRevision> listFromStorage(long start, int limit);

    void startSynced();

    void waitSynced();

    List<AppRevision> getExpired(Date beforeTime, int limit);

    void replace(AppRevision appRevision);

    int cleanDeleted(Date beforeTime, int limit);

    Map<String, Integer> countByApp();

    Set<String> allRevisionIds();
}
